package com.ruoyi.mes.service.impl;

import java.util.List;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.mes.utils.CodeUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.mes.mapper.LnyStoreroomMapper;
import com.ruoyi.mes.domain.LnyStoreroom;
import com.ruoyi.mes.service.ILnyStoreroomService;

/**
 * 库房管理Service业务层处理
 * 
 * @author CFL
 * @date 2024-04-28
 */
@Service
public class LnyStoreroomServiceImpl implements ILnyStoreroomService 
{
    @Autowired
    private LnyStoreroomMapper lnyStoreroomMapper;

    /**
     * 查询库房管理
     * 
     * @param id 库房管理主键
     * @return 库房管理
     */
    @Override
    public LnyStoreroom selectLnyStoreroomById(Long id)
    {
        return lnyStoreroomMapper.selectLnyStoreroomById(id);
    }

    /**
     * 查询库房管理列表
     * 
     * @param lnyStoreroom 库房管理
     * @return 库房管理
     */
    @Override
    public List<LnyStoreroom> selectLnyStoreroomList(LnyStoreroom lnyStoreroom)
    {
        return lnyStoreroomMapper.selectLnyStoreroomList(lnyStoreroom);
    }

    /**
     * 新增库房管理
     * 
     * @param lnyStoreroom 库房管理
     * @return 结果
     */
    @Override
    public int insertLnyStoreroom(LnyStoreroom lnyStoreroom)
    {
        BaseController baseController = new BaseController();
        String username = baseController.getUsername();
        String wareSn = CodeUtils.whareHouseCodeCreat();
        lnyStoreroom.setCreatedBy(username);
        lnyStoreroom.setCreatedTime(DateUtils.getNowDate());
        lnyStoreroom.setSn(wareSn);
        return lnyStoreroomMapper.insertLnyStoreroom(lnyStoreroom);
    }

    /**
     * 修改库房管理
     * 
     * @param lnyStoreroom 库房管理
     * @return 结果
     */
    @Override
    public int updateLnyStoreroom(LnyStoreroom lnyStoreroom)
    {
        return lnyStoreroomMapper.updateLnyStoreroom(lnyStoreroom);
    }

    /**
     * 批量删除库房管理
     * 
     * @param ids 需要删除的库房管理主键
     * @return 结果
     */
    @Override
    public int deleteLnyStoreroomByIds(Long[] ids)
    {
        return lnyStoreroomMapper.deleteLnyStoreroomByIds(ids);
    }

    /**
     * 删除库房管理信息
     * 
     * @param id 库房管理主键
     * @return 结果
     */
    @Override
    public int deleteLnyStoreroomById(Long id)
    {
        return lnyStoreroomMapper.deleteLnyStoreroomById(id);
    }
}
